<?php
namespace app\adminapiv3\service;

use app\common\service;
/**
 * @name: 服务器配置
 * @Param: 
 * @Description: 
 * @Author: foo
 * @Date: 2019-10-23 14:44:02
 */
class Config extends Base 
{
    public $config_type = '';//配置类型
    private $config_path = '';//配置路径
    private $write = true;//是否允许写入
    /**
     * @name: 规则写入
     * @Param: 
     * @Description: 
     * @Author: foo
     * @Date: 2019-09-20 16:02:25
     */
    function configFwrite ($data)
    {
        $Config = new service\Config();
        $Config->config_path = $this->config_path;//路径
        $Config->config_type = $this->config_type;//类型
        if (!$this->write)
        {
            $this->setError($this->CODE_FAIL, '该项配置不允许写入!!');
            return false;
        }
        $this->toDo([$Config, 'fWriteProcess'], [$data]);
    }

    /**
     * @name: 配置获取
     * @Param: 
     * @Description: 
     * @Author: foo
     * @Date: 2019-09-20 16:02:25
     */
    function configFget ()
    {
        $Config = new service\Config();
        $Config->config_path = $this->config_path;//路径
        $Config->config_type = $this->config_type;//类型
        $return = $this->toDo([$Config, 'fGetProcess']);

        return $return;
    }

    /**
     * @name: 检查配置类型
     * @Param: 
     * @Description: 
     * @Author: foo
     * @Date: 2019-10-23 14:46:28
     */
    function checkConfigType ($type)
    {
        $Config = model('Config');
        $return = $this->toDo([$Config, $type]);
        $this->config_type = $type;
        $this->config_path = $Config->config_path;
        $this->write = $Config->write;

        return $return;
    }

}